<!--# layout("/common/layout.html",{"jsBase":"/js/draw/drawProbability/"}){ -->

<form class="layui-form layui-form-pane" id="addForm"  lay-filter="editform">
    <input type="hidden" name="id" id="id">

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label" style="width: 140px">1 腾讯看点</label>
				<div class="layui-input-inline">
                    <select  name="type"  promtion="请选择">
                        <option value="1">腾讯看点</option>
                    </select>
				</div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label" style="width: 140px">概率1</label>
				<div class="layui-input-inline">
                    <input type="text" name="probability1" id="probability1" autocomplete="off"  placeholder="请输入正整数(千分比)"
                           maxlength="4" class="layui-input" lay-verify="required|number" onkeyup="checkNumber(this)">
				</div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label" style="width: 140px">概率2</label>
				<div class="layui-input-inline">
                                <input type="text" name="probability2" id="probability2"  placeholder="请输入正整数(千分比)"  autocomplete="off"
                                       maxlength="4" class="layui-input"  lay-verify="required|number" onkeyup="checkNumber(this)">
				</div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label" style="width: 140px">概率3</label>
				<div class="layui-input-inline">
                        <input type="text" name="probability3" id="probability3"  placeholder="请输入正整数(千分比)"   autocomplete="off"
                               maxlength="4" class="layui-input"  lay-verify="required|number" onkeyup="checkNumber(this)">
				</div>
            </div>

        </div>
    </div>
    <layui:submitButtons id="addButton" />
</form>
<!--#} -->
<script>
    function checkNumber(obj) {
        let replace = obj.value.replace(/\D|^0/g,'');
        if(replace>1000){
            replace = 1000;
        }
        obj.value=replace;
    }
layui.extend({
    loading: '../../../plugins/layui_extends/loading/loading',
}).define([ 'form', 'laydate', 'table','loading','drawProbabilityApi'], function(exports) {
    var form = layui.form;
    var drawProbabilityApi = layui.drawProbabilityApi;
    var index = layui.index;
    var isNew = true;
    <!--# if(!(isEmpty(drawProbabilityJson))){  -->
    isNew = false;
    <!--# } -->
    var view = {
        init:function(){
            Lib.initGenrealForm($("#addForm"),form);
            this.initSubmit();
        },
        initSubmit:function(){
            $("#addButton").click(function(){
                // $("#addButton").hide();
                // $("#addButton-loading").show();
                // $("#addButton-loading").loading();
                form.on('submit(form)', function(){
                    drawProbabilityApi.saveForm(isNew,$('#addForm'),function(){
                        parent.window.dataReload();
                        Common.info("保存成功");
                        Lib.closeFrame();
                    });
                });
            });

            $("#addButton-cancel").click(function(){
                Lib.closeFrame();
            });
        }

    }
    view.init();

    <!--# if(!(isEmpty(drawProbabilityJson))){  -->
    var formJson = ${drawProbabilityJson};
    form.val("editform",formJson);
    <!--# } -->
});
</script>
